package org.jmresler.sakila.utils;

import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.*;

@Slf4j
class NameCaseConverterTest {

    private static final String MUTILATED_NAME = "joHN miChaeL reSlEr";
    private static final String UPPER_CASE_NAME = "JOHN MICHAEL RESLER";
    private static final String EXPECTED_NAME = "John Michael Resler";

    @Test
    public void whenConvertingIncorrectlyCasedName_thenStringConverted() {
        var s = NameCaseConverter.convertToTitleCaseIteratingChars(MUTILATED_NAME);
        assertEquals(EXPECTED_NAME, s);
    }

    @Test
    public void whenConvertingCorrectlyCasedName_thenStringIsNotChanged() {
        var s = NameCaseConverter.convertToTitleCaseIteratingChars(EXPECTED_NAME);
        assertEquals(EXPECTED_NAME, s);
    }

    @Test
    public void whenConvertingUpperCaseCasedName_thenStringConverted() {
        var s = NameCaseConverter.convertToTitleCaseIteratingChars(UPPER_CASE_NAME);
        assertEquals(EXPECTED_NAME, s);
    }

}